package com.boxuegu.guanweihua25.databinding.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.boxuegu.guanweihua25.databinding.Apis;
import com.boxuegu.guanweihua25.databinding.R;
import com.boxuegu.guanweihua25.databinding.model.BannerModel;
import com.boxuegu.guanweihua25.databinding.utils.RetrofitUtils;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_retrofit);
        Retrofit retrofit = RetrofitUtils.getRetrofit();
        Apis apis = retrofit.create(Apis.class);
        Call<BannerModel> bannerModelCall= apis.getBanner();
        bannerModelCall.enqueue(new Callback<BannerModel>() {
            @Override
            public void onResponse(Call<BannerModel> call, Response<BannerModel> response) {
                BannerModel bannerModel=response.body();

            }


            @Override
            public void onFailure(Call<BannerModel> call, Throwable t) {

            }
        });
    }
}
